package com.zhiche.lisa.tms.scheduled;

import com.zhiche.lisa.oms.scheduled.GenerateOrderScheduled;
import com.zhiche.lisa.tms.service.IShipOrderItemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class SyncShippingTime {

    private static final Logger LOGGER = LoggerFactory.getLogger(GenerateOrderScheduled.class);
    @Autowired
    private IShipOrderItemService shipOrderItemService;

    /**
     * 根据OR号同步wms发运时间 定时任务
     */
    @Scheduled(cron = "0 0 0/2 * * *")
    public void syncShippingTime() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            LOGGER.info(simpleDateFormat.format(new Date()) + "根据OR号同步wms发运时间 start ====================");
            shipOrderItemService.selectWmsNotShipped();
            LOGGER.info(simpleDateFormat.format(new Date()) + "根据OR号同步wms发运时间 end ====================");
    }
}
